package cs.rsa.ts14.foxtrot.app;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.LineIterator;

import java.io.File;
import java.io.IOException;


class TimesagFileLines implements TimesagLines {
    private LineIterator iterator;

    public TimesagFileLines(File file) throws IOException {
        iterator = FileUtils.lineIterator(file, "UTF-8");
    }

    @Override
    public boolean hasNext() {
        return iterator.hasNext();
    }

    @Override
    public String next() {
        return iterator.next();
    }

    @Override
    public void remove() {
        iterator.remove();
    }

    @Override
    public void close() throws Exception {
        LineIterator.closeQuietly(iterator);
    }
}
